import org.testng.annotations.Test;

import static org.testng.Assert.*;

public class ShapeAreaCalculatorTest  {

    @Test
    public void testSquareArea() {
        assertEquals(ShapeAreaCalculator.squareArea(5), 25.0, "正⽅ 形⾯积计算错误。");

    }

    @Test
    public void testCircleArea() {
        // 梯形上底2，下底3，⾼4，⾯积应为10.0。容许的误差为0.001
       assertEquals(ShapeAreaCalculator.trapezoidArea(2, 3, 4), 10.0,
                0.001, "梯形⾯积计算错误。");

    }

    @Test
    public void testTriangleArea() {
        // 圆的半径为1时，⾯积应该接近于π。容许的误差为0.001
      assertEquals(ShapeAreaCalculator.circleArea(1), Math.PI, 0.001,
                "圆形⾯积计算错误。");
    }

    @Test
    public void testTrapezoidArea() {
        // 3, 4, 5形成直⻆三⻆形，⾯积应为6
        assertEquals(ShapeAreaCalculator.triangleArea(3, 4, 5), 6.0,
                        0.001, "三⻆形⾯积计算错误。");
    }
}